package com.nova.edc.service.system.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.nova.edc.dao.system.GatewayImageDao;
import com.nova.edc.model.system.GatewayImage;
import com.nova.edc.service.system.GatewayImageService;
import com.nova.frame.dao.buzz.query.Order;
import com.nova.frame.dao.buzz.query.Query;
import com.nova.frame.dao.pager.Page;
import com.nova.frame.dao.pager.PageList;
import com.nova.module.filter.query.Filter;

public class GatewayImageServiceImpl implements GatewayImageService {

    @Autowired
    private GatewayImageDao novaGatewayImageDao;

    @Override
    public List<GatewayImage> findAll() {
        return novaGatewayImageDao.query().list();
    }

    @Override
    public PageList<GatewayImage> findPageGatewayImage(
            GatewayImage gatewayImage, Page page, String sidx, String sord) {
        Query<GatewayImage> query = novaGatewayImageDao.query();
        query.addOrder(Order.custom(sord, sidx));
        Filter.addFilterCondition(query, gatewayImage);
        return query.pageList(page);
    }

    @Override
    public GatewayImage getById(Integer gatewayImageId) {
        return novaGatewayImageDao.getById(String.valueOf(gatewayImageId));
    }

    @Override
    public GatewayImage insert(GatewayImage gatewayImage) {
        return novaGatewayImageDao.insert(gatewayImage);
    }

    @Override
    public int update(GatewayImage gatewayImage) {
        return novaGatewayImageDao.updateNotNull(gatewayImage);
    }

    @Override
    public int delete(int id) {
        return novaGatewayImageDao.deleteById(String.valueOf(id));
    }
}
